﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Runtime.Serialization;

namespace WcfFlashRemoting.Example7.Contract
{
    [ServiceContract(Namespace = "urn:WcfFlashRemoting:Examples:Example7")]
    [ServiceKnownType(typeof(Contract.Student))]
    public interface IRegistrationContract
    {
        [OperationContract]
        string AddPerson(Person person);
    }

    [DataContract]
    [KnownType(typeof(Contract.Teacher))]
    public class Person
    {
        [DataMember]
        public string FirstName { get; set; }
        [DataMember]
        public string LastName { get; set; }
    }

    [DataContract]
    public class Student : Person
    {
        [DataMember]
        public string Major { get; set; }

        public override string ToString()
        {
            return FirstName + " " + LastName + ", " + Major + " major";
        }
    }

    [DataContract]
    public class Teacher : Person
    {
        [DataMember]
        public string Department { get; set; }

        public override string ToString()
        {
            return FirstName + " " + LastName + ", teacher of " + Department;
        }
    }
}
